//
//  UIButton+Extension.m
//  WHYWeibo-OC
//
//  Created by 王洪运 on 15/11/22.
//  Copyright © 2015年 王洪运. All rights reserved.
//

#import "UIButton+WHYExtension.h"

@implementation UIButton (WHYExtension)

+(instancetype)buttonWithImage:(NSString *)image backImage:(NSString *)backImage title:(NSString *)title titleColor:(UIColor *)titleColor font:(CGFloat)font forState:(UIControlState)state{
    
    UIButton *button = [[UIButton alloc] init];
    
    if (image) {
        [button setImage:[UIImage imageNamed:image] forState:state];
    }
    
    if (backImage) {
        [button setBackgroundImage:[UIImage imageNamed:backImage] forState:state];
    }
    
    if (title) {
        [button setTitle:title forState:state];
    }
    
    if (titleColor) {
        [button setTitleColor:titleColor forState:state];
    }
    
    if (font) {
        button.titleLabel.font = [UIFont systemFontOfSize:font];
    }
    
    return button;
}

@end
